//
//  ViewController.m
//  Calculation
//
//  Created by Justsoso on 16/2/19.
//  Copyright © 2016年 NIIT. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()
@property (weak, nonatomic) IBOutlet UITextField *lengthTextField;
@property (weak, nonatomic) IBOutlet UITextField *widthTextField;
@property (weak, nonatomic) IBOutlet UITextField *changArea;


@property (weak, nonatomic) IBOutlet UITextField *radiusTextField;
@property (weak, nonatomic) IBOutlet UITextField *yuanArea;
@end

@implementation ViewController


- (IBAction)backtap:(id)sender
{
    [self.view endEditing:YES];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (IBAction)countBtn:(UIButton *)sender
{
    if (self.lengthTextField.text.length != 0 && self.widthTextField.text.length != 0)
    {
        self.changArea.text = [NSString stringWithFormat:@"%i",[self.lengthTextField.text intValue]*[self.widthTextField.text intValue]];
    }
    if (self.radiusTextField.text.length != 0)
    {
        self.yuanArea.text = [NSString stringWithFormat:@"%.2f",M_PI*pow([self.radiusTextField.text intValue],2 )];
    }
}

@end
